package info.ericbutler.microcosm.entities.ui;

import info.ericbutler.microcosm.world.GameSquare;

import org.newdawn.slick.Animation;
import org.newdawn.slick.Image;

public class Item {
	public static Item	LOGS, ROCKS, WOODEN_WALL_01;
	private String		name;
	private int			itemId, maxStack;
	private Image		inventoryImage;
	private Animation	worldImage;
	private boolean		placeable;
	private GameSquare	worldTile;

	public Item(String name, Image invImg, Animation anim, int itemId, int maxStack, boolean placeable) {
		this.name = name;
		this.inventoryImage = invImg;
		this.worldImage = anim;
		this.itemId = itemId;
		this.maxStack = maxStack;
		this.placeable = placeable;
	}

	public String getName() {
		return name;
	}

	public Item setName(String name) {
		this.name = name;
		return this;
	}

	public int getItemId() {
		return itemId;
	}

	public Item setItemId(int itemId) {
		this.itemId = itemId;
		return this;
	}

	public Image getInventoryImage() {
		return inventoryImage;
	}

	public Item setInventoryImage(Image inventoryImage) {
		this.inventoryImage = inventoryImage;
		return this;
	}

	public Animation getWorldImage() {
		return worldImage;
	}

	public Item setWorldImage(Animation worldImage) {
		this.worldImage = worldImage;
		return this;
	}

	public int getMaxStack() {
		return maxStack;
	}

	public Item setMaxStack(int maxStack) {
		this.maxStack = maxStack;
		return this;
	}

	public boolean isPlaceable() {
		return placeable;
	}

	public Item setPlaceable(boolean placeable) {
		this.placeable = placeable;
		return this;
	}

	public GameSquare getWorldTile() {
		return worldTile;
	}

	public Item setWorldTile(GameSquare worldTile) {
		this.worldTile = worldTile;
		return this;
	}
	
	public Item clone() {
		Item clone = new Item( this.name, this.inventoryImage.copy(), this.worldImage.copy(), this.itemId, this.maxStack, this.placeable).setWorldTile( worldTile );
		return clone;
	}
	
	public boolean equals( Item item ) {
		return this.name.equalsIgnoreCase( item.name );
	}
}
